package com.example.game;

/**
 * @author: HanTing Wang
 * @description:
 * @version:
 * @date: 2022/1/2
 */
public class GameBox {
    private String p1ID;
    private String p2ID;
    private ChessBoard chessBoard;

    public GameBox(String p1, String p2) {
        this.p1ID = p1;
        this.p2ID = p2;
        this.chessBoard = new ChessBoard();
    }

    public boolean checkPlayer(String id) {
        return p1ID.equals(id) || p2ID.equals(id);
    }

    public String getAnotherPlayerID(String id) {
        if (checkPlayer(id)) {
            return this.p1ID.equals(id) ? this.p2ID : this.p1ID;
        } else {
            return null;
        }
    }
}
